#ifndef _CONFIG_H_
#define _CONFIG_H_

#ifdef CH58xBLE_ROM
#include "CH58xBLE_ROM.H"
#else
#include "CH58xBLE_LIB.H"
#endif

#include "CH58x_common.h"

#ifndef BLE_MAC
#define BLE_MAC                             FALSE
#endif

#ifndef DCDC_ENABLE
#define DCDC_ENABLE                         TRUE
#endif

#ifndef HAL_SLEEP
#define HAL_SLEEP                           TRUE
#endif

#ifndef SLEEP_RTC_MIN_TIME                   
#define SLEEP_RTC_MIN_TIME                  US_TO_RTC(1000)
#endif

#ifndef SLEEP_RTC_MAX_TIME                   
#define SLEEP_RTC_MAX_TIME                  (RTC_MAX_COUNT - 1000 * 1000 * 30)
#endif

#ifndef WAKE_UP_RTC_MAX_TIME
#define WAKE_UP_RTC_MAX_TIME                US_TO_RTC(1600)
#endif

#ifndef TEM_SAMPLE
#define TEM_SAMPLE                          FALSE
#endif

#ifndef BLE_CALIBRATION_ENABLE
#define BLE_CALIBRATION_ENABLE              FALSE
#endif

#ifndef BLE_CALIBRATION_PERIOD
#define BLE_CALIBRATION_PERIOD              120000
#endif

#ifndef BLE_SNV
#define BLE_SNV                             TRUE
#endif

#ifndef BLE_SNV_ADDR
#define BLE_SNV_ADDR                        0x77E00 - FLASH_ROM_MAX_SIZE
#endif

#ifndef BLE_SNV_BLOCK
#define BLE_SNV_BLOCK                       256
#endif

#ifndef BLE_SNV_NUM
#define BLE_SNV_NUM                         1
#endif

#ifndef CLK_OSC32K
#define CLK_OSC32K                          1
#endif

#ifndef BLE_MEMHEAP_SIZE
#define BLE_MEMHEAP_SIZE                    (1024 * 10)
#endif

#ifndef BLE_BUFF_MAX_LEN
#define BLE_BUFF_MAX_LEN                    251
#endif

#ifndef BLE_BUFF_NUM
#define BLE_BUFF_NUM                        5
#endif

#ifndef BLE_TX_NUM_EVENT
#define BLE_TX_NUM_EVENT                    1
#endif

#ifndef BLE_TX_POWER
#define BLE_TX_POWER                        LL_TX_POWEER_0_DBM
#endif

#ifndef PERIPHERAL_MAX_CONNECTION
#define PERIPHERAL_MAX_CONNECTION           1
#endif

#ifndef CENTRAL_MAX_CONNECTION
#define CENTRAL_MAX_CONNECTION              3
#endif

extern uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
extern const uint8_t MacAddr[6];

#endif

